package com.demo.coupon;


import com.demo.AppletConstant;
import com.demo.util.Utils;

import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;


/**
 * 专享红包余额查询
 *
 */
public class PointBalance {
	public static SimpleDateFormat SDF_HMS = new SimpleDateFormat("yyyyMMddHHmmss");

	public static void main(String[] args)  throws Exception{

		//调用接口地址
		String url = "https://open.95516.com/open/access/1.0/point.balance";
		
		//拼装参数Map
		Map<String, String> params = new HashMap<String, String>(0);
		params.put("appId", AppletConstant.APP_ID);
		params.put("pointId", "");
		//账户主体类型：01-手机号；02-卡号；03-用户，即openId
		params.put("acctEntityTp", "");
		params.put("acctEntityId", "");
		params.put("backendToken", AppletConstant.backendToken);
		params.put("transTs", SDF_HMS.format(new Date()));
		//积分来源：UP-银联；SC-其他
		params.put("accessId", "");

		params.put("transSeq", "");
		params.put("remark", "");

		//针对敏感字段加密
		Utils.encryptedParamMap(AppletConstant.SYMMETRIC_KEY, params, "acctEntityId");

		//发送请求
		String resultStr = Utils.sendPostGson(url, params);
		
		System.out.println("-------专享红包余额查询:"+resultStr+"---------");
	}
	
}
